package com.xbongbong.workflow.service.field;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.workflow.domain.entity.WorkflowNodeEntity;
import com.xbongbong.workflow.pojo.FilterCondition;
import com.xbongbong.workflow.pojo.WorkflowRulePojo;

import java.util.List;

/**
 * 工作流转中字段解析
 * @author 吴峰
 * @date 2021/06/01 20:04
 */
public interface WorkflowConditionFieldService {

    /**
     * 返回字段类型
     * @return
     */
    List<Integer> fieldType();

    /**
     * 获取固定值字段
     * @param targetField
     * @param workflowConditionPojo
     * @param workflowNodeEntity
     * @return
     * @throws XbbException
     */
    Object handlerFixedValue(FieldAttrEntity targetField, WorkflowNodeEntity workflowNodeEntity, FilterCondition workflowConditionPojo) throws XbbException;

    /**
     * 处理数据
     * @param paasFormDataEntity
     * @param data
     * @param fieldAttrEntity
     * @param targetField
     * @param workflowNodeEntity
     * @param filterCondition
     * @param workflowRulePojo
     * @return
     * @throws XbbException
     */
    Object handlerThisFormField(PaasFormDataEntityExt paasFormDataEntity, JSONObject data, FieldAttrEntity fieldAttrEntity, FieldAttrEntity targetField,
                                WorkflowNodeEntity workflowNodeEntity, FilterCondition filterCondition, WorkflowRulePojo workflowRulePojo ) throws XbbException;


    /**
     * 处理目标表单
     * @param object
     * @param paasFormDataEntity
     * @param data
     * @param fieldAttrEntity 当前表单字段
     * @param targetField 目标表单字段
     * @param workflowNodeEntity
     * @param workflowRulePojo
     * @param filterCondition
     * @return
     * @throws XbbException
     */
    Object handlerTargetFormField(Object object, PaasFormDataEntityExt paasFormDataEntity, JSONObject data, FieldAttrEntity fieldAttrEntity, FieldAttrEntity targetField,WorkflowNodeEntity workflowNodeEntity,
                                  WorkflowRulePojo workflowRulePojo, FilterCondition filterCondition) throws XbbException;
}
